import request from '@/utils/request'
// 分页查询用户信息
export const getAllUserPage = (page, pageSize, username, status, begin, end) => {
  return request.get('/user/page', {
    params: {
      page,
      pageSize,
      username,
      status,
      begin,
      end
    }
  })
}
// 查询所有用户信息
export const getAllUser = () => {
  return request.get('/user/list')
}
// 根据id删除用户
export const deleteUserById = (id) => {
  return request.delete('/user/' + id)
}
// 根据id修改状态status
export const updateStatus = (status, id) => {
  return request.post('/user/status/single/' + status, {
    id
  })
}
// 根据id查询用户信息
export const getUserById = (id) => {
  return request.get('/user/' + id)
}

// 文件上传
export const upload = () => {
  return request('/common')
}

// 提交图片到后端
export const goPicture = (pilePath) => {
  return request.post('/common/pic', {
    pilePath
  })
}

// 新增用户
export const addUser = (username, avatar, status) => {
  return request.post('/user', {
    username,
    avatar,
    status
  })
}

// 根据id修改员工数据
export const updateUserById = (id, username, avatar, status) => {
  return request.put('/user', {
    id,
    username,
    avatar,
    status
  })
}
